import request from '@/utils/request';

// 薪资确认-获取日期列表
export async function querySalaryConfirmDateList() {
    return request('/api/finance/salary/v1/salaryConfirm/datetime', {
        method: 'GET'
    });
}

// 薪资确认-界面预览
export async function querySalaryConfirmInfo(params) {
    return request('/api/finance/salary/v1/salaryConfirm/overview', {
        method: 'POST',
        data: {
            ...params
        }
    });
}

// 薪资确认-确认薪资
export async function onSaveEnsureSalary(params) {
    return request('/api/finance/salary/v1/salaryConfirm/confirm', {
        method: 'POST',
        data: {
            ...params
        }
    });
}

// 薪资确认-异常反馈
export async function onSaveFeedback(params) {
    return request('/api/finance/salary/v1/salaryConfirm/feedback', {
        method: 'POST',
        data: {
            ...params
        }
    });
}

// 薪资确认-反馈记录
export async function queryFeedbackList(params) {
    return request('/api/finance/salary/v1/salaryConfirm/feedback/list', {
        method: 'POST',
        data: {
            ...params
        }
    });
}

// 薪资确认-标记已解决
export async function onSolveFeedback(id) {
    return request(`/api/finance/salary/v1/salaryConfirm/feedback/solve/${id}`, {
        method: 'POST',
        data: {}
    });
}

// ====================================================================================================================
// 薪资确认-时间选择器 -> 王耀辉
export async function queryDateRange(params) {
    return request(`/api/finance/salary/v1/salaryFeedback/datetime/${params.organizationCode}`, {
        method: 'GET'
    });
}

// 列表计数汇总 -> 王耀辉
export async function queryTabCount(params) {
    return request(`/api/finance/salary/v1/salaryFeedback/table/count/${params.organizationCode}`, {
        method: 'GET'
    });
}

// 判断当前账号是否为薪资反馈主管 -> 王耀辉
export async function queryIsFeedbackMaster(params) {
    return request(`/api/finance/salary/v1/salarySet/grant/feedback/isMaster/${params.organizationCode}`, {
        method: 'GET'
    });
}

// 薪资反馈全部列表 -> 王耀辉
export async function feedbackAll(params) {
    return request('/api/finance/salary/v1/salaryFeedback/all/list', {
        method: 'POST',
        data: { ...params }
    });
}

// 常用接收人topN -> 王耀辉
export async function queryTopReceiver(organizationCode) {
    return request(`/api/finance/salary/v1/salaryFeedback/receiver/topN/${organizationCode}`, {
        method: 'GET'
    });
}

// 待分配任务全部指派 -> 王耀辉
export async function batchAssign(params) {
    return request('/api/finance/salary/v1/salaryFeedback/assignToSomeone/all', {
        method: 'POST',
        data: { ...params }
    });
}

// 薪资分配方式详情 -> 王耀辉
export async function assign(params) {
    const { id, employeeCode } = params;
    return request(`/api/finance/salary/v1/salaryFeedback/assignToSomeone/one/${id}/${employeeCode}`, {
        method: 'GET'
    });
}

// 薪资分配方式详情 -> 王耀辉
export async function transfer(params) {
    return request('/api/finance/salary/v1/salaryFeedback/assignToSomeone/transfer', {
        method: 'POST',
        data: { ...params }
    });
}

// 薪资分配方式保存 -> 王耀辉
export async function saveAssignType(params) {
    return request('/api/finance/salary/v1/salaryFeedback/assignType/save', {
        method: 'POST',
        data: { ...params }
    });
}

// 薪资分配方式详情 -> 王耀辉
export async function getAssignType(organizationCode) {
    return request(`/api/finance/salary/v1/salaryFeedback/assignType/info/${organizationCode}`, {
        method: 'GET'
    });
}

// ====================================================================================================================
/**
 * 薪资反馈待接收列表 -> 王耀辉
 */
export async function queryNotReceived(params) {
    return request('/api/finance/salary/v1/salaryFeedback/notReceived/list', {
        method: 'POST',
        data: { ...params }
    });
}

/**
 * 接收全部 -> 王耀辉
 */
export async function batchReceive(params) {
    return request('/api/finance/salary/v1/salaryFeedback/accept/batch', {
        method: 'POST',
        data: { ...params }
    });
}

// 拒绝 -> 王耀辉
export async function reject(params) {
    return request('/api/finance/salary/v1/salaryFeedback/refuse/one', {
        method: 'POST',
        data: { ...params }
    });
}

// 接收 -> 王耀辉
export async function receive(params) {
    const { id } = params;
    return request(`/api/finance/salary/v1/salaryFeedback/accept/one/${id}`, {
        method: 'GET'
    });
}

// ====================================================================================================================
// 薪资反馈待处理列表 -> 王耀辉
export async function queryNotHandle(params) {
    return request('/api/finance/salary/v1/salaryFeedback/notDealWith/list', {
        method: 'POST',
        data: { ...params }
    });
}

// 薪资反馈结果记录 -> 王耀辉
export async function dealWith(params) {
    return request('/api/finance/salary/v1/salaryFeedback/dealWith', {
        method: 'POST',
        data: { ...params }
    });
}

// 薪资反馈结果记录 -> 王耀辉
export async function noticeHandled(params) {
    const { id } = params;

    return request(`/api/finance/salary/v1/salaryFeedback/notify/done/${id}`, {
        method: 'GET'
    });
}

// ====================================================================================================================
// 薪资反馈已处理列表 -> 王耀辉
export async function queryHandled(params) {
    return request('/api/finance/salary/v1/salaryFeedback/done/list', {
        method: 'POST',
        data: { ...params }
    });
}

// 薪资反馈待分配列表 -> 王耀辉
export async function queryNotAssign(params) {
    return request('/api/finance/salary/v1/salaryFeedback/notAssign/list', {
        method: 'POST',
        data: { ...params }
    });
}

// 鱼骨图 -> 王耀辉
export async function queryFishBone() {
    return request('/api/finance/salary/v1/salaryConfirm/fishBone', {
        method: 'GET'
    });
}
